<template>
    <div>
        <div class="mainbg" style="background:#7ABDE9;"><img src="../../assets/app/7.jpeg" /></div>
        <div class="banner">
                <el-carousel :interval="2000" height="170px">
                    <el-carousel-item v-for="(item,index) in imgList" :key="index">
                   <img :src="item.src" alt="">
                    </el-carousel-item>
                </el-carousel>
        </div>
        <ul class="mainmenu">
            <li>
                <router-link to="/singup" >
                    <p>
                        <img src="../../assets/app/singup.png" />
                        <span>学生签到</span>
                        <span></span>
                    </p>
                </router-link>
            </li>
            <li>
                <router-link to="/experience" >
                    <p>
                        <img src="../../assets/app/experience.png" />
                        <span>心得体会</span>
                        <span :class="{active: isActive,stylecoll:istrue,yellowcoll:isyellow}" >{{experience}}</span>
                    </p>
               </router-link>
            </li>
            <li>
                <router-link to="/personcenter" >
                    <p>
                        <img src="../../assets/app/personcenter.png" />
                        <span>个人中心</span>
                        <span></span>
                    </p>
                </router-link>
            </li>
            <li>
                <router-link to="/datacenter" >
                    <p>
                        <img src="../../assets/app/datacenter.png"/>
                        <span>数据中心</span>
                        <span></span>
                    </p>
                </router-link>
            </li>
            <li>
                <router-link to="/courseinteract" >
                    <p>
                      <img src="../../assets/app/courseactive.png" />
                      <span>课堂互动</span>
                      <span></span>
                    </p>
                </router-link>
            </li>
            <li>
                <router-link to="/exam" >
                    <p>
                        <img src="../../assets/app/test.png" />
                        <span>综合考试</span>
                        <span v-if="this.examscore===-1" style="color: red">未考试</span>
                        <span v-else-if="this.examscore===1" style="color: #a6f360">已通过</span>
                        <span v-else style="color: yellow">未通过</span>
                    </p>
                </router-link>
            </li>                
        </ul>
        <div class="bottombar">
            <router-link to='/appmain'>
                <img src="../../assets/app/home.png" alt="">
            </router-link>  

        </div>
    </div>
</template>
<script>
export default {
  data() {
    return {
      //轮播图
      imgList: [
        { src: require("../../assets/app/index/1.jpg") },
        { src: require("../../assets/app/index/2.jpg") },
        { src: require("../../assets/app/index/3.jpg") },
        { src: require("../../assets/app/index/4.jpg") }
      ],
      student: JSON.parse(localStorage.getItem("studentinfo")), //获取信息
      experience: "未提交",
      isActive: true, //红色
      istrue: false,//绿色
      isyellow:false,//黄色
      examscore:-1,
    };
  },
  //初始化
  mounted() {
    //校验心得是否提交
    this.experiencelode();
    //校验综合考试是否完成
    this.scorelode()
  },
  //事件
  methods: {
    //初始化判断心得是否提交
    experiencelode() {
      this.$axios
        .get("/Experience", { params: { Card: this.student.St_Card } })
        .then(Json => {
          if (Json.data == "no") {
            //没有提交
          } else {
            if(Json.data.Exp_Flag=="1"){
              this.experience = "已提交";
              this.isActive= false; //红色
              this.istrue=true;//绿色
              this.isyellow=false;//黄色
            }else{
              this.experience = "已保存";
              this.isActive= false; //红色
              this.istrue= false;//绿色
              this.isyellow=true;//黄色
            }                        
          }
        })
        .catch(err => {
          this.$message.error("获取信息失败！请重新登录");
        });
    },
    scorelode() {
      this.$axios
        .get("/ExamStart/getstuexaminfo", { params: { Card: this.student.St_Card } })
        .then(Json => {
            this.examscore = Json.data;
        })
        .catch(err => {
          this.$message.error("获取信息失败！请重新登录");
        });
    }
  }
};
</script>
<style scoped>
.el-carousel__item h3 {
  color: #475669;
  font-size: 18px;
  opacity: 0.75;
  line-height: 300px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
.banner img {
  width: 100%;
  height: 170px;
}
.active {
  color: red;
}
.stylecoll {
  color: #a6f360;
}
.yellowcoll{
  color:yellow
}
html,
body {
  color: #222;
  font-family: Microsoft YaHei, Helvitica, Verdana, Tohoma, Arial, san-serif;
  margin: 0;
  padding: 0;
  text-decoration: none;
}
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
code,
form,
fieldset,
legend,
input,
textarea,
p,
blockquote,
th,
td {
  margin: 0;
  padding: 0;
}
img {
  border: 0;
}
ol,
ul {
  list-style: none outside none;
  margin: 0;
  padding: 0;
}
a {
  color: #000000;
  text-decoration: none;
}
.clr {
  display: block;
  clear: both;
  height: 0;
  overflow: hidden;
}
.copyright {
  padding: 8px;
  text-align: center;
  font-size: 14px;
  color: #fff;
  position: relative;
  z-index: 1;
}
.copyright a {
  color: #fff;
}
h2 {
  font-size: 16px;
}
body .mainbg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
body .mainbg img {
  width: 100%;
  height: 100%;
}
body .mainmenu:after {
  clear: both;
  content: " ";
  display: block;
}
body .mainmenu {
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  margin-bottom: 5rem;
}
body .mainmenu li {
  float: left;
  margin-left: 6.6%;
  margin-top: 5%;
  width: 40%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 7px;
}
body .mainmenu li p {
  text-align: center;
  display: block;
  margin: 12px 0 5px 0;
}
body .mainmenu li a {
  display: block;
  color: #fff;
  text-align: center;
  overflow: hidden;
}
body .mainmenu li:active {
  background-color: rgba(255, 255, 255, 0.1);
}
body .mainmenu li a img {
  width: 25%;
}
body .mainmenu li a span {
  clear: both;
  display: block;
  padding: 0px 10px;
  line-height: 20px;
  height: 20px;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
#insert1,
#insert2 {
  position: relative;
}
body .mainmenu li {
  background-color: rgba(0, 0, 0, 0.3);
  border: 0px solid rgba(0, 0, 0, 0.15);
}
.bottombar {
  position: fixed;
  z-index: 900;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  border: 1px solid white;
  height: 50px;
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  background: -webkit-gradient(
    linear,
    0 0,
    0 100%,
    from(#524945),
    to(#48403c),
    color-stop(60%, #524945)
  );
  background: -o-gradient(
    linear,
    0 0,
    0 100%,
    from(#524945),
    to(#48403c),
    color-stop(60%, #524945)
  );
  background: gradient(
    linear,
    0 0,
    0 100%,
    from(#524945),
    to(#48403c),
    color-stop(60%, #524945)
  );

  box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.1) inset;
}
.bottombar img {
  background: white;
  padding: 10px;
  border-radius: 50%;
  position: relative;
  /* top: -20px; */
  text-shadow: 0 1px rgba(0, 0, 0, 0.3);
  /* border: 5px solid gray; */
}
</style>
